import { Context } from "koa";
import SysUserServer from "../../server/Sys/SysUserServer";
import response from "../../util/response";
/*
 * @Author: fishroom
 * @Date: 2023-01-04 20:15:03
 * @LastEditTime: 2023-01-04 20:20:58
 * @FilePath: \koa\app\controller\Sys\updateMyInfo.ts
 */
class UpdateMyInfo {
  async updateMyAvatarUrl(ctx: Context) {
    try {
      ctx.$user.avatarUrl = ctx.request.body.avatarUrl;
      SysUserServer.updateUserById({ ...ctx.$user });
      response.CxtSuccess(ctx, { msg: "修改成功" });
    } catch (error) {
      response.CxtError(ctx, "失败", { error });
    }
  }
}
export default new UpdateMyInfo();
